import Vue from 'vue'
import VueRouter from 'vue-router'
import article from '../views/article'
import login from '../views/login'
import register from '../views/register'
import userInfo from '../views/userInfo'
import collection from '../views/collection'
import admin from '../views/admin/admin'
import adminWriterArticle from '../views/admin/adminWriterArticle'
import adminArticles from '../views/admin/adminArticles'
import adminUsers from '../views/admin/adminUsers'
import introduction from "@/views/introduction";
import allArticles from "@/views/allArticles";
import comment from "@/views/comment";
import adminIndexChange from "@/views/admin/adminIndexChange";
Vue.use(VueRouter)

const routes = [
    {//博主简介
        path: '/',
        name: 'Introduction',
        component: introduction
    },
    {//博主简介
        path: '/index',
        name: 'Home',
        component: introduction
    },
    {
        path: '/comment',
        name: 'Home',
        component: comment
    },
    {//收藏栏
        path:'/collection',
        name:'Collection',
        component: collection
    },
    {//所有文章展示
        path: '/articles',
        name: 'Articles',
        component: allArticles
    },
    {//每篇文章
        path: '/article/:id',
        name: 'article',
        component: article
    },
    {//登录
        path: '/login',
        name: 'Login',
        component: login
    },
    {//注册
        path: '/register',
        name: 'Register',
        component: register
    },
    {//个人信息
        path: '/userInfo/:username',
        name: 'UserInfo',
        component: userInfo
    },
    {//管理员
        path: '/admin',
        name: 'admin',
        component: admin,
    },
    {//管理员操作，分别为文章编写、文章管理、用户管理、
        path: '/admin/article',
        name: 'adminWriterArticle',
        component: adminWriterArticle
    },
    {
        path: '/admin/articles',
        name: 'adminArticles',
        component: adminArticles
    },
    {
        path: '/admin/users',
        name: 'adminUsers',
        component: adminUsers
    },
    {
        path: '/admin/indexChange',
        name: 'adminIndexChange',
        component: adminIndexChange,
    },
]

const router = new VueRouter({
    mode: 'history',
    base: process.env.BASE_URL,
    routes
})

export default router


